package com.atguigu.proxy.cdlib;

/**
 * @program: design-patterns
 * @author: yangshen
 * @description:
 * @create: 2022-02-25 12:15
 **/
public class Client {
    public static void main(String[] args) {
        //创建目标对象
        TeacherDao target = new TeacherDao();

        //获取代理对象，并将目标对象传递给代理对象
        TeacherDao proxyInstance =(TeacherDao) new ProxyFactory(target).getProxyInstance();

        //执行代理对象的方法，触发 intercept 方法，从而实现 对目标对象的调用
        String res = proxyInstance.teach();
        System.out.println("返回结果 - " + res);
    }
}
